<template>
	<view class="video-container">
		<u-navbar title="我的收藏" placeholder> </u-navbar>
		<getdatascrollview ref="getdatascrollview" :api="api" :seardata="searchdata" :customStyle="scrollviewstyle"
			:onPullingfalge="false">
			<template #default="{ list }">
				<view class="goodslist">
					<goodsitem v-for="(item, key) in list" :dicts="dicts" :item="item" type='favorite'
						:levelTypeList="levelTypeList">
					</goodsitem>
				</view>
			</template>
		</getdatascrollview>
	</view>
</template>

<script>
	import logo from "@/static/logo.png";
	import {
		getUser,
	} from "@/api/user.js";
	//   import { getReleaseAllPage } from "@/api/release.js";
	import {
		getDicts
	} from "@/api/dictdata";
	import {
		getProductClassAll
	} from "@/api/index.js";
	import {
		getMemberPage
	} from "@/api/favorite.js";
	export default {
		data() {
			return {
				logo,
				bgColor: "#39C03E",
				api: getMemberPage,
				searchdata: {
					userId: ""
				},
				user: {},
				scrollviewstyle: {

				},
				dicts: {},
				levelTypeList: [],
			};
		},
		mounted() {
			this.init();
		},
		methods: {
			async init() {
				let userdata = await getUser();
				this.user = userdata.data;
				this.searchdata.userId = this.user.id;
				this.$nextTick(() => {
					this.$refs.getdatascrollview.onRefresh();
				});
				console.log(this.user, "this.user");

				const res = await getProductClassAll();
				this.levelTypeList = res.data;
				let {
					data
				} = await getDicts("transactional_mode,manage_model");
				// dictType
				let transactional_mode = data.filter(e => {
					return e.dictType == 'transactional_mode'
				});
				let manage_model = data.filter(e => {
					return e.dictType == 'manage_model'
				});
				this.dicts = {
					transactional_mode,
					manage_model,
				};
			},
		},
	};
</script>

<style lang="scss" scoped>
	.video-container {

		//   height: 100vh;
		//   display: flex;
		//   flex-direction: column;
		.goodslist {
			display: flex;
			justify-content: space-between;
			flex-wrap: wrap;
			padding: 0 20rpx;
		}
	}
</style>